<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Flow: flow::net_flow::Port_space Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">Flow<span id="projectnumber">&#160;2.0.0</span>
   </div>
   <div id="projectbrief">Flow project: Full implementation reference.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceflow.html">flow</a></li><li class="navelem"><a class="el" href="namespaceflow_1_1net__flow.html">net_flow</a></li><li class="navelem"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html">Port_space</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-attribs">Static Public Attributes</a> &#124;
<a href="#pri-types">Private Types</a> &#124;
<a href="#pri-methods">Private Member Functions</a> &#124;
<a href="#pri-static-methods">Static Private Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a> &#124;
<a href="#pri-static-attribs">Static Private Attributes</a> &#124;
<a href="classflow_1_1net__flow_1_1Port__space-members.html">List of all members</a>  </div>
  <div class="headertitle"><div class="title">flow::net_flow::Port_space Class Reference</div></div>
</div><!--header-->
<div class="contents">

<p>Internal <code><a class="el" href="namespaceflow_1_1net__flow.html" title="Flow module containing the API and implementation of the Flow network protocol, a TCP-inspired stream...">net_flow</a></code> class that maintains the available Flow-protocol port space, somewhat similarly to the classic TCP or UDP port scheme.  
 <a href="classflow_1_1net__flow_1_1Port__space.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="port__space_8hpp_source.html">port_space.hpp</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for flow::net_flow::Port_space:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1net__flow_1_1Port__space__inherit__graph.svg" width="310" height="119"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for flow::net_flow::Port_space:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1net__flow_1_1Port__space__coll__graph.svg" width="1487" height="471"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ad02a2c57aa6854659621af98b64d3638"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ad02a2c57aa6854659621af98b64d3638">Port_space</a> (<a class="el" href="classflow_1_1log_1_1Logger.html">log::Logger</a> *logger)</td></tr>
<tr class="memdesc:ad02a2c57aa6854659621af98b64d3638"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs the <a class="el" href="classflow_1_1net__flow_1_1Port__space.html" title="Internal net_flow class that maintains the available Flow-protocol port space, somewhat similarly to ...">Port_space</a> with all ports available.  <a href="classflow_1_1net__flow_1_1Port__space.html#ad02a2c57aa6854659621af98b64d3638">More...</a><br /></td></tr>
<tr class="separator:ad02a2c57aa6854659621af98b64d3638"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1168841ecd09d3187f9803eac2b8b703"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a1168841ecd09d3187f9803eac2b8b703">reserve_port</a> (<a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a> port, <a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09">Error_code</a> *err_code)</td></tr>
<tr class="memdesc:a1168841ecd09d3187f9803eac2b8b703"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reserve the specified service port, or <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a65dbe99c7c4433e6c090f26c92ab3f78" title="Reserve a randomly chosen available ephemeral port.">reserve_ephemeral_port()</a> if the specified port is <a class="el" href="namespaceflow_1_1net__flow.html#a9dd0c9d8de00fab78d8b0a3f50dad2a9" title="Special Flow port value used to indicate &quot;invalid port&quot; or &quot;please pick a random available ephemeral ...">S_PORT_ANY</a>.  <a href="classflow_1_1net__flow_1_1Port__space.html#a1168841ecd09d3187f9803eac2b8b703">More...</a><br /></td></tr>
<tr class="separator:a1168841ecd09d3187f9803eac2b8b703"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a65dbe99c7c4433e6c090f26c92ab3f78"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a65dbe99c7c4433e6c090f26c92ab3f78">reserve_ephemeral_port</a> (<a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09">Error_code</a> *err_code)</td></tr>
<tr class="memdesc:a65dbe99c7c4433e6c090f26c92ab3f78"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reserve a randomly chosen available ephemeral port.  <a href="classflow_1_1net__flow_1_1Port__space.html#a65dbe99c7c4433e6c090f26c92ab3f78">More...</a><br /></td></tr>
<tr class="separator:a65dbe99c7c4433e6c090f26c92ab3f78"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9fe1be917ff7584ff587b5da5967127a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a9fe1be917ff7584ff587b5da5967127a">return_port</a> (<a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a> port, <a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09">Error_code</a> *err_code)</td></tr>
<tr class="memdesc:a9fe1be917ff7584ff587b5da5967127a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return a previously reserved port (of any type).  <a href="classflow_1_1net__flow_1_1Port__space.html#a9fe1be917ff7584ff587b5da5967127a">More...</a><br /></td></tr>
<tr class="separator:a9fe1be917ff7584ff587b5da5967127a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classflow_1_1log_1_1Log__context"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classflow_1_1log_1_1Log__context')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classflow_1_1log_1_1Log__context.html">flow::log::Log_context</a></td></tr>
<tr class="memitem:ae7100d2dd130d8f130e3e64fdb1f4fd9 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Log__context.html#ae7100d2dd130d8f130e3e64fdb1f4fd9">Log_context</a> (<a class="el" href="classflow_1_1log_1_1Logger.html">Logger</a> *logger=0)</td></tr>
<tr class="memdesc:ae7100d2dd130d8f130e3e64fdb1f4fd9 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs <a class="el" href="classflow_1_1log_1_1Log__context.html" title="Convenience class that simply stores a Logger and/or Component passed into a constructor; and returns...">Log_context</a> by storing the given pointer to a <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a> and a null <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a>.  <a href="classflow_1_1log_1_1Log__context.html#ae7100d2dd130d8f130e3e64fdb1f4fd9">More...</a><br /></td></tr>
<tr class="separator:ae7100d2dd130d8f130e3e64fdb1f4fd9 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af1ac7f30ab442c3c6aa6079335df6c9a inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memTemplParams" colspan="2">template&lt;typename Component_payload &gt; </td></tr>
<tr class="memitem:af1ac7f30ab442c3c6aa6079335df6c9a inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memTemplItemLeft" align="right" valign="top">&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Log__context.html#af1ac7f30ab442c3c6aa6079335df6c9a">Log_context</a> (<a class="el" href="classflow_1_1log_1_1Logger.html">Logger</a> *logger, Component_payload component_payload)</td></tr>
<tr class="memdesc:af1ac7f30ab442c3c6aa6079335df6c9a inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs <a class="el" href="classflow_1_1log_1_1Log__context.html" title="Convenience class that simply stores a Logger and/or Component passed into a constructor; and returns...">Log_context</a> by storing the given pointer to a <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a> and a new <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> storing the specified generically typed payload (an <code>enum</code> value).  <a href="classflow_1_1log_1_1Log__context.html#af1ac7f30ab442c3c6aa6079335df6c9a">More...</a><br /></td></tr>
<tr class="separator:af1ac7f30ab442c3c6aa6079335df6c9a inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5c57a7f44959a01ca9a1c948a6686cc0 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Log__context.html#a5c57a7f44959a01ca9a1c948a6686cc0">Log_context</a> (const <a class="el" href="classflow_1_1log_1_1Log__context.html">Log_context</a> &amp;src)</td></tr>
<tr class="memdesc:a5c57a7f44959a01ca9a1c948a6686cc0 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor that stores equal <code>Logger*</code> and <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> values as the source.  <a href="classflow_1_1log_1_1Log__context.html#a5c57a7f44959a01ca9a1c948a6686cc0">More...</a><br /></td></tr>
<tr class="separator:a5c57a7f44959a01ca9a1c948a6686cc0 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3d4e624833d96bdafa1485ffff472509 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Log__context.html#a3d4e624833d96bdafa1485ffff472509">Log_context</a> (<a class="el" href="classflow_1_1log_1_1Log__context.html">Log_context</a> &amp;&amp;src)</td></tr>
<tr class="memdesc:a3d4e624833d96bdafa1485ffff472509 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="mdescLeft">&#160;</td><td class="mdescRight">Move constructor that makes this equal to <code>src</code>, while the latter becomes as-if default-constructed.  <a href="classflow_1_1log_1_1Log__context.html#a3d4e624833d96bdafa1485ffff472509">More...</a><br /></td></tr>
<tr class="separator:a3d4e624833d96bdafa1485ffff472509 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5d628315d5a93908d47a281980d3113e inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classflow_1_1log_1_1Log__context.html">Log_context</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Log__context.html#a5d628315d5a93908d47a281980d3113e">operator=</a> (const <a class="el" href="classflow_1_1log_1_1Log__context.html">Log_context</a> &amp;src)</td></tr>
<tr class="memdesc:a5d628315d5a93908d47a281980d3113e inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="mdescLeft">&#160;</td><td class="mdescRight">Assignment operator that behaves similarly to the copy constructor.  <a href="classflow_1_1log_1_1Log__context.html#a5d628315d5a93908d47a281980d3113e">More...</a><br /></td></tr>
<tr class="separator:a5d628315d5a93908d47a281980d3113e inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aae857197aecba8606c32296bc7bec308 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classflow_1_1log_1_1Log__context.html">Log_context</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Log__context.html#aae857197aecba8606c32296bc7bec308">operator=</a> (<a class="el" href="classflow_1_1log_1_1Log__context.html">Log_context</a> &amp;&amp;src)</td></tr>
<tr class="memdesc:aae857197aecba8606c32296bc7bec308 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="mdescLeft">&#160;</td><td class="mdescRight">Move assignment operator that behaves similarly to the move constructor.  <a href="classflow_1_1log_1_1Log__context.html#aae857197aecba8606c32296bc7bec308">More...</a><br /></td></tr>
<tr class="separator:aae857197aecba8606c32296bc7bec308 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa6bb8e4250586425631ef80063caf155 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Log__context.html#aa6bb8e4250586425631ef80063caf155">swap</a> (<a class="el" href="classflow_1_1log_1_1Log__context.html">Log_context</a> &amp;other)</td></tr>
<tr class="memdesc:aa6bb8e4250586425631ef80063caf155 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="mdescLeft">&#160;</td><td class="mdescRight">Swaps <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a> pointers and <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> objects held by <code>*this</code> and <code>other</code>.  <a href="classflow_1_1log_1_1Log__context.html#aa6bb8e4250586425631ef80063caf155">More...</a><br /></td></tr>
<tr class="separator:aa6bb8e4250586425631ef80063caf155 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af4db395042b065b00398cd59845dcb4d inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classflow_1_1log_1_1Logger.html">Logger</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Log__context.html#af4db395042b065b00398cd59845dcb4d">get_logger</a> () const</td></tr>
<tr class="memdesc:af4db395042b065b00398cd59845dcb4d inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the stored <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a> pointer, particularly as many <code>FLOW_LOG_*()</code> macros expect.  <a href="classflow_1_1log_1_1Log__context.html#af4db395042b065b00398cd59845dcb4d">More...</a><br /></td></tr>
<tr class="separator:af4db395042b065b00398cd59845dcb4d inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8a5fef42dc2cedf3c0d1a6e83beb2948 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classflow_1_1log_1_1Component.html">Component</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Log__context.html#a8a5fef42dc2cedf3c0d1a6e83beb2948">get_log_component</a> () const</td></tr>
<tr class="memdesc:a8a5fef42dc2cedf3c0d1a6e83beb2948 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns reference to the stored <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> object, particularly as many <code>FLOW_LOG_*()</code> macros expect.  <a href="classflow_1_1log_1_1Log__context.html#a8a5fef42dc2cedf3c0d1a6e83beb2948">More...</a><br /></td></tr>
<tr class="separator:a8a5fef42dc2cedf3c0d1a6e83beb2948 inherit pub_methods_classflow_1_1log_1_1Log__context"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-attribs" name="pub-static-attribs"></a>
Static Public Attributes</h2></td></tr>
<tr class="memitem:af0c60ec4732021d52a19e5d2f6dc8b35"><td class="memItemLeft" align="right" valign="top">static const size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#af0c60ec4732021d52a19e5d2f6dc8b35">S_NUM_PORTS</a> = size_t(std::numeric_limits&lt;<a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a>&gt;::max()) + 1</td></tr>
<tr class="memdesc:af0c60ec4732021d52a19e5d2f6dc8b35"><td class="mdescLeft">&#160;</td><td class="mdescRight">Total number of ports in the port space, including <a class="el" href="namespaceflow_1_1net__flow.html#a9dd0c9d8de00fab78d8b0a3f50dad2a9" title="Special Flow port value used to indicate &quot;invalid port&quot; or &quot;please pick a random available ephemeral ...">S_PORT_ANY</a>.  <a href="classflow_1_1net__flow_1_1Port__space.html#af0c60ec4732021d52a19e5d2f6dc8b35">More...</a><br /></td></tr>
<tr class="separator:af0c60ec4732021d52a19e5d2f6dc8b35"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad93c0b6f23be37efe0f96ab066ff9bf8"><td class="memItemLeft" align="right" valign="top">static const size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ad93c0b6f23be37efe0f96ab066ff9bf8">S_NUM_SERVICE_PORTS</a> = <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#af0c60ec4732021d52a19e5d2f6dc8b35">S_NUM_PORTS</a> / 2 - 1</td></tr>
<tr class="memdesc:ad93c0b6f23be37efe0f96ab066ff9bf8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Total number of "service" ports (ones that can be reserved by number with <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a1168841ecd09d3187f9803eac2b8b703" title="Reserve the specified service port, or reserve_ephemeral_port() if the specified port is S_PORT_ANY.">reserve_port()</a>).  <a href="classflow_1_1net__flow_1_1Port__space.html#ad93c0b6f23be37efe0f96ab066ff9bf8">More...</a><br /></td></tr>
<tr class="separator:ad93c0b6f23be37efe0f96ab066ff9bf8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a06fb009aafc77f75241f721734fe3cc4"><td class="memItemLeft" align="right" valign="top">static const size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a06fb009aafc77f75241f721734fe3cc4">S_NUM_EPHEMERAL_PORTS</a> = <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#af0c60ec4732021d52a19e5d2f6dc8b35">S_NUM_PORTS</a> - <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ad93c0b6f23be37efe0f96ab066ff9bf8">S_NUM_SERVICE_PORTS</a> - 1</td></tr>
<tr class="memdesc:a06fb009aafc77f75241f721734fe3cc4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Total number of "ephemeral" ports (ones reserved at random with <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a65dbe99c7c4433e6c090f26c92ab3f78" title="Reserve a randomly chosen available ephemeral port.">reserve_ephemeral_port()</a>).  <a href="classflow_1_1net__flow_1_1Port__space.html#a06fb009aafc77f75241f721734fe3cc4">More...</a><br /></td></tr>
<tr class="separator:a06fb009aafc77f75241f721734fe3cc4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6d07833521960b2f90806bfa7728cfd8"><td class="memItemLeft" align="right" valign="top">static const <a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a6d07833521960b2f90806bfa7728cfd8">S_FIRST_SERVICE_PORT</a> = 1</td></tr>
<tr class="memdesc:a6d07833521960b2f90806bfa7728cfd8"><td class="mdescLeft">&#160;</td><td class="mdescRight">The port number of the lowest service port.  <a href="classflow_1_1net__flow_1_1Port__space.html#a6d07833521960b2f90806bfa7728cfd8">More...</a><br /></td></tr>
<tr class="separator:a6d07833521960b2f90806bfa7728cfd8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab9a614b67638cbd9526eb82033a53352"><td class="memItemLeft" align="right" valign="top">static const <a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ab9a614b67638cbd9526eb82033a53352">S_FIRST_EPHEMERAL_PORT</a> = <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a6d07833521960b2f90806bfa7728cfd8">S_FIRST_SERVICE_PORT</a> + <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ad93c0b6f23be37efe0f96ab066ff9bf8">S_NUM_SERVICE_PORTS</a></td></tr>
<tr class="memdesc:ab9a614b67638cbd9526eb82033a53352"><td class="mdescLeft">&#160;</td><td class="mdescRight">The port number of the lowest ephemeral port.  <a href="classflow_1_1net__flow_1_1Port__space.html#ab9a614b67638cbd9526eb82033a53352">More...</a><br /></td></tr>
<tr class="separator:ab9a614b67638cbd9526eb82033a53352"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-types" name="pri-types"></a>
Private Types</h2></td></tr>
<tr class="memitem:a729dc0add1c98ebde5b3549d3ec132e2"><td class="memItemLeft" align="right" valign="top">using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a729dc0add1c98ebde5b3549d3ec132e2">Bit_set</a> = boost::dynamic_bitset&lt;&gt;</td></tr>
<tr class="memdesc:a729dc0add1c98ebde5b3549d3ec132e2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Short-hand for bit set of arbitary length, representing a port set (each bit is a port; 1 open, 0 reserved).  <a href="classflow_1_1net__flow_1_1Port__space.html#a729dc0add1c98ebde5b3549d3ec132e2">More...</a><br /></td></tr>
<tr class="separator:a729dc0add1c98ebde5b3549d3ec132e2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af4690f25a42ebb61561f91c9187bcc30"><td class="memItemLeft" align="right" valign="top">using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#af4690f25a42ebb61561f91c9187bcc30">Random_generator</a> = <a class="el" href="classflow_1_1util_1_1Rnd__gen__uniform__range__base.html#a519fc83fd1c52a82618cd85f3a089668">util::Rnd_gen_uniform_range_base::Random_generator</a></td></tr>
<tr class="memdesc:af4690f25a42ebb61561f91c9187bcc30"><td class="mdescLeft">&#160;</td><td class="mdescRight">Random number generator.  <a href="classflow_1_1net__flow_1_1Port__space.html#af4690f25a42ebb61561f91c9187bcc30">More...</a><br /></td></tr>
<tr class="separator:af4690f25a42ebb61561f91c9187bcc30"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afb17ac5ea9708262d0c374dc246a7244"><td class="memItemLeft" align="right" valign="top">using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#afb17ac5ea9708262d0c374dc246a7244">flow_port_sans_overflow_t</a> = uint32_t</td></tr>
<tr class="memdesc:afb17ac5ea9708262d0c374dc246a7244"><td class="mdescLeft">&#160;</td><td class="mdescRight">A type same as <a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d" title="Logical Flow port type (analogous to a UDP/TCP port in spirit but in no way relevant to UDP/TCP).">flow_port_t</a> but larger, useful when doing arithmetic that might hit overflow in corner cases.  <a href="classflow_1_1net__flow_1_1Port__space.html#afb17ac5ea9708262d0c374dc246a7244">More...</a><br /></td></tr>
<tr class="separator:afb17ac5ea9708262d0c374dc246a7244"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-methods" name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr class="memitem:ad5a6a34a24c95364bb8348e5030d955b"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ad5a6a34a24c95364bb8348e5030d955b">find_available_port_bit_idx</a> (const <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a729dc0add1c98ebde5b3549d3ec132e2">Bit_set</a> &amp;ports)</td></tr>
<tr class="memdesc:ad5a6a34a24c95364bb8348e5030d955b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Helper method that, given a reference to a bit set representing available ports (1 available, 0 reserved) finds a random available (1) port in that bit set.  <a href="classflow_1_1net__flow_1_1Port__space.html#ad5a6a34a24c95364bb8348e5030d955b">More...</a><br /></td></tr>
<tr class="separator:ad5a6a34a24c95364bb8348e5030d955b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-static-methods" name="pri-static-methods"></a>
Static Private Member Functions</h2></td></tr>
<tr class="memitem:ac43e4303aac2bde697b99bf03901ec85"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classbool.html">bool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ac43e4303aac2bde697b99bf03901ec85">is_service_port</a> (<a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a> port)</td></tr>
<tr class="memdesc:ac43e4303aac2bde697b99bf03901ec85"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns <code>true</code> if and only if the given port is a service port (as opposed to ephemeral or <a class="el" href="namespaceflow_1_1net__flow.html#a9dd0c9d8de00fab78d8b0a3f50dad2a9" title="Special Flow port value used to indicate &quot;invalid port&quot; or &quot;please pick a random available ephemeral ...">S_PORT_ANY</a>).  <a href="classflow_1_1net__flow_1_1Port__space.html#ac43e4303aac2bde697b99bf03901ec85">More...</a><br /></td></tr>
<tr class="separator:ac43e4303aac2bde697b99bf03901ec85"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-attribs" name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr class="memitem:a1f8e8e52bf4ec90e0b13d9159c403eae"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a729dc0add1c98ebde5b3549d3ec132e2">Bit_set</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a1f8e8e52bf4ec90e0b13d9159c403eae">m_service_ports</a></td></tr>
<tr class="memdesc:a1f8e8e52bf4ec90e0b13d9159c403eae"><td class="mdescLeft">&#160;</td><td class="mdescRight">Current service port set.  <a href="classflow_1_1net__flow_1_1Port__space.html#a1f8e8e52bf4ec90e0b13d9159c403eae">More...</a><br /></td></tr>
<tr class="separator:a1f8e8e52bf4ec90e0b13d9159c403eae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeafab53f020093121f5e57f1e692a9df"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a729dc0add1c98ebde5b3549d3ec132e2">Bit_set</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#aeafab53f020093121f5e57f1e692a9df">m_ephemeral_ports</a></td></tr>
<tr class="memdesc:aeafab53f020093121f5e57f1e692a9df"><td class="mdescLeft">&#160;</td><td class="mdescRight">Current ephemeral port set; indexing analogous to <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a1f8e8e52bf4ec90e0b13d9159c403eae" title="Current service port set.">m_service_ports</a> but starting at <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ab9a614b67638cbd9526eb82033a53352" title="The port number of the lowest ephemeral port.">S_FIRST_EPHEMERAL_PORT</a>.  <a href="classflow_1_1net__flow_1_1Port__space.html#aeafab53f020093121f5e57f1e692a9df">More...</a><br /></td></tr>
<tr class="separator:aeafab53f020093121f5e57f1e692a9df"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abc455d9e1b00886f7985c7b5fd115862"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a729dc0add1c98ebde5b3549d3ec132e2">Bit_set</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#abc455d9e1b00886f7985c7b5fd115862">m_ephemeral_and_recent_ephemeral_ports</a></td></tr>
<tr class="memdesc:abc455d9e1b00886f7985c7b5fd115862"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set representing the union of the set of current reserved ephemeral ports and the set of the last up-to-<a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a0bdaf744b7089027c8d952b67d1f9cc0" title="The maximum size of m_recent_ephemeral_ports.">S_MAX_RECENT_EPHEMERAL_PORTS</a> returned and available ephemeral ports.  <a href="classflow_1_1net__flow_1_1Port__space.html#abc455d9e1b00886f7985c7b5fd115862">More...</a><br /></td></tr>
<tr class="separator:abc455d9e1b00886f7985c7b5fd115862"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae401e02d49ce557bbc5474e049eb5455"><td class="memItemLeft" align="right" valign="top">std::queue&lt; <a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ae401e02d49ce557bbc5474e049eb5455">m_recent_ephemeral_ports</a></td></tr>
<tr class="memdesc:ae401e02d49ce557bbc5474e049eb5455"><td class="mdescLeft">&#160;</td><td class="mdescRight">A FIFO of recently used but currently available ephemeral ports.  <a href="classflow_1_1net__flow_1_1Port__space.html#ae401e02d49ce557bbc5474e049eb5455">More...</a><br /></td></tr>
<tr class="separator:ae401e02d49ce557bbc5474e049eb5455"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae4714945b23e588b1554240fa590560a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#af4690f25a42ebb61561f91c9187bcc30">Random_generator</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ae4714945b23e588b1554240fa590560a">m_rnd_generator</a></td></tr>
<tr class="memdesc:ae4714945b23e588b1554240fa590560a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Random number generator for picking ports.  <a href="classflow_1_1net__flow_1_1Port__space.html#ae4714945b23e588b1554240fa590560a">More...</a><br /></td></tr>
<tr class="separator:ae4714945b23e588b1554240fa590560a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-static-attribs" name="pri-static-attribs"></a>
Static Private Attributes</h2></td></tr>
<tr class="memitem:a0bdaf744b7089027c8d952b67d1f9cc0"><td class="memItemLeft" align="right" valign="top">static const size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a0bdaf744b7089027c8d952b67d1f9cc0">S_MAX_RECENT_EPHEMERAL_PORTS</a> = <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a06fb009aafc77f75241f721734fe3cc4">S_NUM_EPHEMERAL_PORTS</a> / 32</td></tr>
<tr class="memdesc:a0bdaf744b7089027c8d952b67d1f9cc0"><td class="mdescLeft">&#160;</td><td class="mdescRight">The maximum size of <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ae401e02d49ce557bbc5474e049eb5455" title="A FIFO of recently used but currently available ephemeral ports.">m_recent_ephemeral_ports</a>.  <a href="classflow_1_1net__flow_1_1Port__space.html#a0bdaf744b7089027c8d952b67d1f9cc0">More...</a><br /></td></tr>
<tr class="separator:a0bdaf744b7089027c8d952b67d1f9cc0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >Internal <code><a class="el" href="namespaceflow_1_1net__flow.html" title="Flow module containing the API and implementation of the Flow network protocol, a TCP-inspired stream...">net_flow</a></code> class that maintains the available Flow-protocol port space, somewhat similarly to the classic TCP or UDP port scheme. </p>
<p >The class's main use case it to be stored in a <a class="el" href="classflow_1_1net__flow_1_1Node.html" title="An object of this class is a single Flow-protocol networking node, in the sense that: (1) it has a di...">Node</a>, though it could be used in other scenarios of desired. <code><a class="el" href="namespaceflow_1_1net__flow.html" title="Flow module containing the API and implementation of the Flow network protocol, a TCP-inspired stream...">net_flow</a></code> users should not use this class directly.</p>
<p >The port scheme is similar to TCP or UDP's but not identical. <a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d" title="Logical Flow port type (analogous to a UDP/TCP port in spirit but in no way relevant to UDP/TCP).">net_flow::flow_port_t</a> maximum value defines the total number of ports available. Port <a class="el" href="namespaceflow_1_1net__flow.html#a9dd0c9d8de00fab78d8b0a3f50dad2a9" title="Special Flow port value used to indicate &quot;invalid port&quot; or &quot;please pick a random available ephemeral ...">S_PORT_ANY</a> is a special value and cannot be used as a port. The remaining port space is divided into 2 parts: <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ad93c0b6f23be37efe0f96ab066ff9bf8" title="Total number of &quot;service&quot; ports (ones that can be reserved by number with reserve_port()).">S_NUM_SERVICE_PORTS</a> "service
ports" and <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a06fb009aafc77f75241f721734fe3cc4" title="Total number of &quot;ephemeral&quot; ports (ones reserved at random with reserve_ephemeral_port()).">S_NUM_EPHEMERAL_PORTS</a> "ephemeral ports." Thus the port ranges are [<code>S_FIRST_SERVICE_PORT</code>, <code>S_FIRST_SERVICE_PORT + S_NUM_SERVICE_PORTS - 1</code>] and [<code>S_FIRST_EPHEMERAL_PORT</code>, <code>S_FIRST_EPHEMERAL_PORT + S_NUM_EPHEMERAL_PORTS - 1</code>], respectively. Both types of ports are on the same number line so that Flow-protocol socket addressing can be symmetrical between client and server once a connection has been set up.</p>
<p >At construction all ports are available. A port can then be "reserved" by the class user. That port can then no longer be reserved until it is "returned" via <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a9fe1be917ff7584ff587b5da5967127a" title="Return a previously reserved port (of any type).">return_port()</a>.</p>
<p >One can either reserve to a specified service port (<a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a1168841ecd09d3187f9803eac2b8b703" title="Reserve the specified service port, or reserve_ephemeral_port() if the specified port is S_PORT_ANY.">reserve_port()</a>) or a random available ephemeral port (<a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a65dbe99c7c4433e6c090f26c92ab3f78" title="Reserve a randomly chosen available ephemeral port.">reserve_ephemeral_port()</a>). Unlike with TCP and UDP ports, it's not possible to reserve a user-supplied ephemeral port (<a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a1168841ecd09d3187f9803eac2b8b703" title="Reserve the specified service port, or reserve_ephemeral_port() if the specified port is S_PORT_ANY.">reserve_port()</a> will fail in this case). Therefore, service ports and ephemeral ports are entirely separate (it is not merely a convention as in TCP and UDP ports).</p>
<p >While this is transparent to the class user, this implementation avoids reserving ephemeral ports that have been recently returned, to avoid confusion in the socket implementation. It does so by keeping a queue (of some reasonably large length up to a maximum size) of such ports. Ports within this queue are reserved only if there is absolutely no ephemeral port space left other than the ports on the queue.</p>
<p >Main (all?) differences from TCP/UDP ports: different allocation of ephemeral vs. non-ephemeral port space; no privileged ports; enforced inability to reserve a specific ephemeral port; no service name -&gt; port number mapping (yet?).</p>
<h3>Thread safety</h3>
<p >Separate objects: All functionality safe for simultaneous execution from multiple threads. Same object: Not safe to execute a non-const operation simultaneously with any other operation; otherwise safe. Rationale: <a class="el" href="classflow_1_1net__flow_1_1Node.html" title="An object of this class is a single Flow-protocol networking node, in the sense that: (1) it has a di...">Node</a> only deals with its <a class="el" href="classflow_1_1net__flow_1_1Port__space.html" title="Internal net_flow class that maintains the available Flow-protocol port space, somewhat similarly to ...">Port_space</a> in thread W.</p>
<h3>Implementation notes</h3>
<p ><code>bit_set</code> objects are used to represent the set of reserved vs. available ports of a given type (0 means taken, 1 means available). This is not only quick and memory-compact but also allows a convenient search for a random available port (random bit -&gt; <code>find_next()</code> if not open -&gt; <code>find_first()</code> if still not found -&gt; no ports available if even still not found).</p>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000071">Todo:</a></b></dt><dd>While the ephemeral port reuse avoidance works well within a single <a class="el" href="classflow_1_1net__flow_1_1Port__space.html" title="Internal net_flow class that maintains the available Flow-protocol port space, somewhat similarly to ...">Port_space</a> lifetime, it does not carry over across different Port_spaces. I.e., if <a class="el" href="classflow_1_1net__flow_1_1Port__space.html" title="Internal net_flow class that maintains the available Flow-protocol port space, somewhat similarly to ...">Port_space</a> is destructed and then constructed, the container of recently used ports starts out empty, so a port may (with some low but sizable probability) be reused. This could be avoided by persisting (e.g., via boost.serialization) those structures to disk (perhaps at a user-supplied <code>boost::filesystem::path</code>) in <code>~Port_space()</code>. This wouldn't work if <a class="el" href="classflow_1_1net__flow_1_1Port__space.html" title="Internal net_flow class that maintains the available Flow-protocol port space, somewhat similarly to ...">Port_space</a> crashed, however. To solve that, we could easily start a thread in <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ad02a2c57aa6854659621af98b64d3638" title="Constructs the Port_space with all ports available.">Port_space()</a> (and join it in <code>~Port_space()</code>) that would save that state every N seconds. If that's not enough, we can instead have that thread run a boost.asio <code>io_context::run()</code> event loop and <code>post(io_context&amp;)</code> the save operation onto it (from arbitrary threads) each time a new ephemeral port is reserved (with some kind of protection against incessant disk writing built into this worker thread; e.g., don't save if saved in the last N msec). </dd></dl>

<p class="definition">Definition at line <a class="el" href="port__space_8hpp_source.html#l00091">91</a> of file <a class="el" href="port__space_8hpp_source.html">port_space.hpp</a>.</p>
</div><h2 class="groupheader">Member Typedef Documentation</h2>
<a id="a729dc0add1c98ebde5b3549d3ec132e2" name="a729dc0add1c98ebde5b3549d3ec132e2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a729dc0add1c98ebde5b3549d3ec132e2">&#9670;&nbsp;</a></span>Bit_set</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">using <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a729dc0add1c98ebde5b3549d3ec132e2">flow::net_flow::Port_space::Bit_set</a> =  boost::dynamic_bitset&lt;&gt;</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Short-hand for bit set of arbitary length, representing a port set (each bit is a port; 1 open, 0 reserved). </p>

<p class="definition">Definition at line <a class="el" href="port__space_8hpp_source.html#l00164">164</a> of file <a class="el" href="port__space_8hpp_source.html">port_space.hpp</a>.</p>

</div>
</div>
<a id="afb17ac5ea9708262d0c374dc246a7244" name="afb17ac5ea9708262d0c374dc246a7244"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afb17ac5ea9708262d0c374dc246a7244">&#9670;&nbsp;</a></span>flow_port_sans_overflow_t</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">using <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#afb17ac5ea9708262d0c374dc246a7244">flow::net_flow::Port_space::flow_port_sans_overflow_t</a> =  uint32_t</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>A type same as <a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d" title="Logical Flow port type (analogous to a UDP/TCP port in spirit but in no way relevant to UDP/TCP).">flow_port_t</a> but larger, useful when doing arithmetic that might hit overflow in corner cases. </p>

<p class="definition">Definition at line <a class="el" href="port__space_8hpp_source.html#l00170">170</a> of file <a class="el" href="port__space_8hpp_source.html">port_space.hpp</a>.</p>

</div>
</div>
<a id="af4690f25a42ebb61561f91c9187bcc30" name="af4690f25a42ebb61561f91c9187bcc30"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af4690f25a42ebb61561f91c9187bcc30">&#9670;&nbsp;</a></span>Random_generator</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">using <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#af4690f25a42ebb61561f91c9187bcc30">flow::net_flow::Port_space::Random_generator</a> =  <a class="el" href="classflow_1_1util_1_1Rnd__gen__uniform__range__base.html#a519fc83fd1c52a82618cd85f3a089668">util::Rnd_gen_uniform_range_base::Random_generator</a></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Random number generator. </p>

<p class="definition">Definition at line <a class="el" href="port__space_8hpp_source.html#l00167">167</a> of file <a class="el" href="port__space_8hpp_source.html">port_space.hpp</a>.</p>

</div>
</div>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ad02a2c57aa6854659621af98b64d3638" name="ad02a2c57aa6854659621af98b64d3638"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad02a2c57aa6854659621af98b64d3638">&#9670;&nbsp;</a></span>Port_space()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">flow::net_flow::Port_space::Port_space </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classflow_1_1log_1_1Logger.html">log::Logger</a> *&#160;</td>
          <td class="paramname"><em>logger</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Constructs the <a class="el" href="classflow_1_1net__flow_1_1Port__space.html" title="Internal net_flow class that maintains the available Flow-protocol port space, somewhat similarly to ...">Port_space</a> with all ports available. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">logger</td><td>The Logger implementation to use subsequently. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="port__space_8cpp_source.html#l00045">45</a> of file <a class="el" href="port__space_8cpp_source.html">port_space.cpp</a>.</p>

<p class="reference">References <a class="el" href="log_8hpp_source.html#l00197">FLOW_LOG_INFO</a>, <a class="el" href="port__space_8hpp_source.html#l00234">m_ephemeral_and_recent_ephemeral_ports</a>, <a class="el" href="port__space_8hpp_source.html#l00219">m_ephemeral_ports</a>, <a class="el" href="port__space_8hpp_source.html#l00213">m_service_ports</a>, <a class="el" href="port__space_8hpp_source.html#l00111">S_FIRST_EPHEMERAL_PORT</a>, <a class="el" href="port__space_8hpp_source.html#l00108">S_FIRST_SERVICE_PORT</a>, <a class="el" href="port__space_8hpp_source.html#l00105">S_NUM_EPHEMERAL_PORTS</a>, <a class="el" href="port__space_8hpp_source.html#l00102">S_NUM_SERVICE_PORTS</a>, and <a class="el" href="port__space_8cpp_source.html#l00033">flow::net_flow::S_PORT_ANY</a>.</p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="ad5a6a34a24c95364bb8348e5030d955b" name="ad5a6a34a24c95364bb8348e5030d955b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad5a6a34a24c95364bb8348e5030d955b">&#9670;&nbsp;</a></span>find_available_port_bit_idx()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">size_t flow::net_flow::Port_space::find_available_port_bit_idx </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a729dc0add1c98ebde5b3549d3ec132e2">Bit_set</a> &amp;&#160;</td>
          <td class="paramname"><em>ports</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Helper method that, given a reference to a bit set representing available ports (1 available, 0 reserved) finds a random available (1) port in that bit set. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ports</td><td>A bit set representing port availability (e.g., <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#aeafab53f020093121f5e57f1e692a9df" title="Current ephemeral port set; indexing analogous to m_service_ports but starting at S_FIRST_EPHEMERAL_P...">m_ephemeral_ports</a>). </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The bit index of a random available port, or <code>Bit_set::npos</code> if all are taken. </dd></dl>

<p class="definition">Definition at line <a class="el" href="port__space_8cpp_source.html#l00261">261</a> of file <a class="el" href="port__space_8cpp_source.html">port_space.cpp</a>.</p>

<p class="reference">References <a class="el" href="port__space_8hpp_source.html#l00246">m_rnd_generator</a>.</p>

<p class="reference">Referenced by <a class="el" href="port__space_8cpp_source.html#l00112">reserve_ephemeral_port()</a>.</p>
<div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1net__flow_1_1Port__space_ad5a6a34a24c95364bb8348e5030d955b_icgraph.svg" width="952" height="78"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>

</div>
</div>
<a id="ac43e4303aac2bde697b99bf03901ec85" name="ac43e4303aac2bde697b99bf03901ec85"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac43e4303aac2bde697b99bf03901ec85">&#9670;&nbsp;</a></span>is_service_port()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classbool.html">bool</a> flow::net_flow::Port_space::is_service_port </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a>&#160;</td>
          <td class="paramname"><em>port</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns <code>true</code> if and only if the given port is a service port (as opposed to ephemeral or <a class="el" href="namespaceflow_1_1net__flow.html#a9dd0c9d8de00fab78d8b0a3f50dad2a9" title="Special Flow port value used to indicate &quot;invalid port&quot; or &quot;please pick a random available ephemeral ...">S_PORT_ANY</a>). </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">port</td><td>Port to check. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>See above. </dd></dl>

<p class="definition">Definition at line <a class="el" href="port__space_8cpp_source.html#l00067">67</a> of file <a class="el" href="port__space_8cpp_source.html">port_space.cpp</a>.</p>

<p class="reference">References <a class="el" href="util_2util_8hpp_source.html#l00287">flow::util::in_closed_open_range()</a>, <a class="el" href="port__space_8hpp_source.html#l00108">S_FIRST_SERVICE_PORT</a>, and <a class="el" href="port__space_8hpp_source.html#l00102">S_NUM_SERVICE_PORTS</a>.</p>

<p class="reference">Referenced by <a class="el" href="port__space_8cpp_source.html#l00075">reserve_port()</a>, and <a class="el" href="port__space_8cpp_source.html#l00175">return_port()</a>.</p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1net__flow_1_1Port__space_ac43e4303aac2bde697b99bf03901ec85_cgraph.svg" width="335" height="47"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
<div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1net__flow_1_1Port__space_ac43e4303aac2bde697b99bf03901ec85_icgraph.svg" width="1758" height="355"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>

</div>
</div>
<a id="a65dbe99c7c4433e6c090f26c92ab3f78" name="a65dbe99c7c4433e6c090f26c92ab3f78"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a65dbe99c7c4433e6c090f26c92ab3f78">&#9670;&nbsp;</a></span>reserve_ephemeral_port()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a> flow::net_flow::Port_space::reserve_ephemeral_port </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09">Error_code</a> *&#160;</td>
          <td class="paramname"><em>err_code</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reserve a randomly chosen available ephemeral port. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">err_code</td><td>See <a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09" title="Short-hand for a boost.system error code (which basically encapsulates an integer/enum error code and...">flow::Error_code</a> docs for error reporting semantics. <a class="el" href="namespaceflow_1_1net__flow_1_1error.html#a18e13de77b119ea0f2be411490859482" title="All possible errors returned (via flow::Error_code arguments) by flow::net_flow functions/methods.">error::Code</a> generated: <a class="el" href="namespaceflow_1_1net__flow_1_1error.html#a18e13de77b119ea0f2be411490859482a1975df7ed76c42660cbdc6039d5c70c5" title="No more ephemeral Flow ports available.">error::Code::S_OUT_OF_PORTS</a>. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>On success, the reserved port; on failure, <a class="el" href="namespaceflow_1_1net__flow.html#a9dd0c9d8de00fab78d8b0a3f50dad2a9" title="Special Flow port value used to indicate &quot;invalid port&quot; or &quot;please pick a random available ephemeral ...">S_PORT_ANY</a>. </dd></dl>

<p class="definition">Definition at line <a class="el" href="port__space_8cpp_source.html#l00112">112</a> of file <a class="el" href="port__space_8cpp_source.html">port_space.cpp</a>.</p>

<p class="reference">References <a class="el" href="port__space_8cpp_source.html#l00261">find_available_port_bit_idx()</a>, <a class="el" href="error_2error_8hpp_source.html#l00202">FLOW_ERROR_EMIT_ERROR</a>, <a class="el" href="log_8hpp_source.html#l00197">FLOW_LOG_INFO</a>, <a class="el" href="log_8hpp_source.html#l00227">FLOW_LOG_TRACE</a>, <a class="el" href="port__space_8hpp_source.html#l00234">m_ephemeral_and_recent_ephemeral_ports</a>, <a class="el" href="port__space_8hpp_source.html#l00219">m_ephemeral_ports</a>, <a class="el" href="port__space_8hpp_source.html#l00243">m_recent_ephemeral_ports</a>, <a class="el" href="port__space_8hpp_source.html#l00111">S_FIRST_EPHEMERAL_PORT</a>, <a class="el" href="port__space_8hpp_source.html#l00105">S_NUM_EPHEMERAL_PORTS</a>, <a class="el" href="namespaceflow_1_1net__flow_1_1error.html#a18e13de77b119ea0f2be411490859482a1975df7ed76c42660cbdc6039d5c70c5">flow::net_flow::error::S_OUT_OF_PORTS</a>, and <a class="el" href="port__space_8cpp_source.html#l00033">flow::net_flow::S_PORT_ANY</a>.</p>

<p class="reference">Referenced by <a class="el" href="port__space_8cpp_source.html#l00075">reserve_port()</a>.</p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1net__flow_1_1Port__space_a65dbe99c7c4433e6c090f26c92ab3f78_cgraph.svg" width="403" height="59"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
<div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1net__flow_1_1Port__space_a65dbe99c7c4433e6c090f26c92ab3f78_icgraph.svg" width="760" height="71"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>

</div>
</div>
<a id="a1168841ecd09d3187f9803eac2b8b703" name="a1168841ecd09d3187f9803eac2b8b703"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1168841ecd09d3187f9803eac2b8b703">&#9670;&nbsp;</a></span>reserve_port()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a> flow::net_flow::Port_space::reserve_port </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a>&#160;</td>
          <td class="paramname"><em>port</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09">Error_code</a> *&#160;</td>
          <td class="paramname"><em>err_code</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reserve the specified service port, or <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a65dbe99c7c4433e6c090f26c92ab3f78" title="Reserve a randomly chosen available ephemeral port.">reserve_ephemeral_port()</a> if the specified port is <a class="el" href="namespaceflow_1_1net__flow.html#a9dd0c9d8de00fab78d8b0a3f50dad2a9" title="Special Flow port value used to indicate &quot;invalid port&quot; or &quot;please pick a random available ephemeral ...">S_PORT_ANY</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">port</td><td>A valid and still available service port number, or <a class="el" href="namespaceflow_1_1net__flow.html#a9dd0c9d8de00fab78d8b0a3f50dad2a9" title="Special Flow port value used to indicate &quot;invalid port&quot; or &quot;please pick a random available ephemeral ...">S_PORT_ANY</a>. </td></tr>
    <tr><td class="paramname">err_code</td><td>See <a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09" title="Short-hand for a boost.system error code (which basically encapsulates an integer/enum error code and...">flow::Error_code</a> docs for error reporting semantics. <a class="el" href="namespaceflow_1_1net__flow_1_1error.html#a18e13de77b119ea0f2be411490859482" title="All possible errors returned (via flow::Error_code arguments) by flow::net_flow functions/methods.">error::Code</a> generated: <a class="el" href="namespaceflow_1_1net__flow_1_1error.html#a18e13de77b119ea0f2be411490859482abb79e941df00b67a8631a9361ee5a4d1" title="Flow port number is not in the valid service port number range.">error::Code::S_INVALID_SERVICE_PORT_NUMBER</a>, <a class="el" href="namespaceflow_1_1net__flow_1_1error.html#a18e13de77b119ea0f2be411490859482a2c42b01b60ebe4834e9be3933ce94cb6" title="Flow port already reserved.">error::Code::S_PORT_TAKEN</a>, or whatever set by <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a65dbe99c7c4433e6c090f26c92ab3f78" title="Reserve a randomly chosen available ephemeral port.">reserve_ephemeral_port()</a> if <code>port == S_PORT_ANY</code>. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>On success, the reserved port; on failure, <a class="el" href="namespaceflow_1_1net__flow.html#a9dd0c9d8de00fab78d8b0a3f50dad2a9" title="Special Flow port value used to indicate &quot;invalid port&quot; or &quot;please pick a random available ephemeral ...">S_PORT_ANY</a>. </dd></dl>

<p class="definition">Definition at line <a class="el" href="port__space_8cpp_source.html#l00075">75</a> of file <a class="el" href="port__space_8cpp_source.html">port_space.cpp</a>.</p>

<p class="reference">References <a class="el" href="error_2error_8hpp_source.html#l00202">FLOW_ERROR_EMIT_ERROR</a>, <a class="el" href="log_8hpp_source.html#l00197">FLOW_LOG_INFO</a>, <a class="el" href="log_8hpp_source.html#l00227">FLOW_LOG_TRACE</a>, <a class="el" href="port__space_8cpp_source.html#l00067">is_service_port()</a>, <a class="el" href="port__space_8hpp_source.html#l00213">m_service_ports</a>, <a class="el" href="port__space_8cpp_source.html#l00112">reserve_ephemeral_port()</a>, <a class="el" href="port__space_8hpp_source.html#l00108">S_FIRST_SERVICE_PORT</a>, <a class="el" href="namespaceflow_1_1net__flow_1_1error.html#a18e13de77b119ea0f2be411490859482abb79e941df00b67a8631a9361ee5a4d1">flow::net_flow::error::S_INVALID_SERVICE_PORT_NUMBER</a>, <a class="el" href="port__space_8cpp_source.html#l00033">flow::net_flow::S_PORT_ANY</a>, and <a class="el" href="namespaceflow_1_1net__flow_1_1error.html#a18e13de77b119ea0f2be411490859482a2c42b01b60ebe4834e9be3933ce94cb6">flow::net_flow::error::S_PORT_TAKEN</a>.</p>

<p class="reference">Referenced by <a class="el" href="server__socket_8cpp_source.html#l00215">flow::net_flow::Node::listen_worker()</a>.</p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1net__flow_1_1Port__space_a1168841ecd09d3187f9803eac2b8b703_cgraph.svg" width="587" height="120"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
<div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1net__flow_1_1Port__space_a1168841ecd09d3187f9803eac2b8b703_icgraph.svg" width="512" height="71"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>

</div>
</div>
<a id="a9fe1be917ff7584ff587b5da5967127a" name="a9fe1be917ff7584ff587b5da5967127a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9fe1be917ff7584ff587b5da5967127a">&#9670;&nbsp;</a></span>return_port()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void flow::net_flow::Port_space::return_port </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a>&#160;</td>
          <td class="paramname"><em>port</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09">Error_code</a> *&#160;</td>
          <td class="paramname"><em>err_code</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return a previously reserved port (of any type). </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">port</td><td>A previously reserved port. </td></tr>
    <tr><td class="paramname">err_code</td><td>See <a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09" title="Short-hand for a boost.system error code (which basically encapsulates an integer/enum error code and...">flow::Error_code</a> docs for error reporting semantics. <a class="el" href="namespaceflow_1_1net__flow_1_1error.html#a18e13de77b119ea0f2be411490859482" title="All possible errors returned (via flow::Error_code arguments) by flow::net_flow functions/methods.">error::Code</a> generated: <a class="el" href="namespaceflow_1_1net__flow_1_1error.html#a18e13de77b119ea0f2be411490859482a2c42b01b60ebe4834e9be3933ce94cb6" title="Flow port already reserved.">error::Code::S_PORT_TAKEN</a>. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="port__space_8cpp_source.html#l00175">175</a> of file <a class="el" href="port__space_8cpp_source.html">port_space.cpp</a>.</p>

<p class="reference">References <a class="el" href="error_2error_8hpp_source.html#l00202">FLOW_ERROR_EMIT_ERROR</a>, <a class="el" href="log_8hpp_source.html#l00197">FLOW_LOG_INFO</a>, <a class="el" href="log_8hpp_source.html#l00227">FLOW_LOG_TRACE</a>, <a class="el" href="util_2util_8hpp_source.html#l00287">flow::util::in_closed_open_range()</a>, <a class="el" href="port__space_8cpp_source.html#l00067">is_service_port()</a>, <a class="el" href="port__space_8hpp_source.html#l00234">m_ephemeral_and_recent_ephemeral_ports</a>, <a class="el" href="port__space_8hpp_source.html#l00219">m_ephemeral_ports</a>, <a class="el" href="port__space_8hpp_source.html#l00243">m_recent_ephemeral_ports</a>, <a class="el" href="port__space_8hpp_source.html#l00213">m_service_ports</a>, <a class="el" href="port__space_8hpp_source.html#l00111">S_FIRST_EPHEMERAL_PORT</a>, <a class="el" href="port__space_8hpp_source.html#l00108">S_FIRST_SERVICE_PORT</a>, <a class="el" href="namespaceflow_1_1net__flow_1_1error.html#a18e13de77b119ea0f2be411490859482a0eac39cc62ef841927a2f69a3c04db4e">flow::net_flow::error::S_INTERNAL_ERROR_PORT_NOT_TAKEN</a>, <a class="el" href="port__space_8hpp_source.html#l00205">S_MAX_RECENT_EPHEMERAL_PORTS</a>, and <a class="el" href="port__space_8hpp_source.html#l00105">S_NUM_EPHEMERAL_PORTS</a>.</p>

<p class="reference">Referenced by <a class="el" href="peer__socket_8cpp_source.html#l05600">flow::net_flow::Node::close_connection_immediately()</a>, <a class="el" href="server__socket_8cpp_source.html#l00361">flow::net_flow::Node::close_empty_server_immediately()</a>, and <a class="el" href="server__socket_8cpp_source.html#l00215">flow::net_flow::Node::listen_worker()</a>.</p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1net__flow_1_1Port__space_a9fe1be917ff7584ff587b5da5967127a_cgraph.svg" width="511" height="75"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
<div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1net__flow_1_1Port__space_a9fe1be917ff7584ff587b5da5967127a_icgraph.svg" width="1588" height="343"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>

</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a id="abc455d9e1b00886f7985c7b5fd115862" name="abc455d9e1b00886f7985c7b5fd115862"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abc455d9e1b00886f7985c7b5fd115862">&#9670;&nbsp;</a></span>m_ephemeral_and_recent_ephemeral_ports</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a729dc0add1c98ebde5b3549d3ec132e2">Bit_set</a> flow::net_flow::Port_space::m_ephemeral_and_recent_ephemeral_ports</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set representing the union of the set of current reserved ephemeral ports and the set of the last up-to-<a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a0bdaf744b7089027c8d952b67d1f9cc0" title="The maximum size of m_recent_ephemeral_ports.">S_MAX_RECENT_EPHEMERAL_PORTS</a> returned and available ephemeral ports. </p>
<p >In other words, the union of the ports represented by <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#aeafab53f020093121f5e57f1e692a9df" title="Current ephemeral port set; indexing analogous to m_service_ports but starting at S_FIRST_EPHEMERAL_P...">m_ephemeral_ports</a> and <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ae401e02d49ce557bbc5474e049eb5455" title="A FIFO of recently used but currently available ephemeral ports.">m_recent_ephemeral_ports</a>. In yet other words, a 1 bit represents an available and not-recently-used port. This is kept for performance, so that when choosing a random port one can find a random 1 bit to find a not-recently-used and open port.</p>
<p >Invariants:</p><ul>
<li>Port <code>P</code> is in <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ae401e02d49ce557bbc5474e049eb5455" title="A FIFO of recently used but currently available ephemeral ports.">m_recent_ephemeral_ports</a> =&gt; bit <code>(P - S_FIRST_EPHEMERAL_PORT)</code> is 0 in this.</li>
<li>Bit <code>N</code> is 0 in <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#aeafab53f020093121f5e57f1e692a9df" title="Current ephemeral port set; indexing analogous to m_service_ports but starting at S_FIRST_EPHEMERAL_P...">m_ephemeral_ports</a> =&gt; bit <code>N</code> is 0 in this.</li>
<li>All other bits are 1. </li>
</ul>

<p class="definition">Definition at line <a class="el" href="port__space_8hpp_source.html#l00234">234</a> of file <a class="el" href="port__space_8hpp_source.html">port_space.hpp</a>.</p>

<p class="reference">Referenced by <a class="el" href="port__space_8cpp_source.html#l00045">Port_space()</a>, <a class="el" href="port__space_8cpp_source.html#l00112">reserve_ephemeral_port()</a>, and <a class="el" href="port__space_8cpp_source.html#l00175">return_port()</a>.</p>

</div>
</div>
<a id="aeafab53f020093121f5e57f1e692a9df" name="aeafab53f020093121f5e57f1e692a9df"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aeafab53f020093121f5e57f1e692a9df">&#9670;&nbsp;</a></span>m_ephemeral_ports</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a729dc0add1c98ebde5b3549d3ec132e2">Bit_set</a> flow::net_flow::Port_space::m_ephemeral_ports</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Current ephemeral port set; indexing analogous to <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a1f8e8e52bf4ec90e0b13d9159c403eae" title="Current service port set.">m_service_ports</a> but starting at <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ab9a614b67638cbd9526eb82033a53352" title="The port number of the lowest ephemeral port.">S_FIRST_EPHEMERAL_PORT</a>. </p>

<p class="definition">Definition at line <a class="el" href="port__space_8hpp_source.html#l00219">219</a> of file <a class="el" href="port__space_8hpp_source.html">port_space.hpp</a>.</p>

<p class="reference">Referenced by <a class="el" href="port__space_8cpp_source.html#l00045">Port_space()</a>, <a class="el" href="port__space_8cpp_source.html#l00112">reserve_ephemeral_port()</a>, and <a class="el" href="port__space_8cpp_source.html#l00175">return_port()</a>.</p>

</div>
</div>
<a id="ae401e02d49ce557bbc5474e049eb5455" name="ae401e02d49ce557bbc5474e049eb5455"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae401e02d49ce557bbc5474e049eb5455">&#9670;&nbsp;</a></span>m_recent_ephemeral_ports</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::queue&lt;<a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a>&gt; flow::net_flow::Port_space::m_recent_ephemeral_ports</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>A FIFO of recently used but currently available ephemeral ports. </p>
<p >Algorithm: push port onto back of queue when it's returned; pop front of queue if <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ae401e02d49ce557bbc5474e049eb5455" title="A FIFO of recently used but currently available ephemeral ports.">m_recent_ephemeral_ports</a> is beyond <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a0bdaf744b7089027c8d952b67d1f9cc0" title="The maximum size of m_recent_ephemeral_ports.">S_MAX_RECENT_EPHEMERAL_PORTS</a> long. If port is needed and no more non-<a class="el" href="classflow_1_1net__flow_1_1Port__space.html#abc455d9e1b00886f7985c7b5fd115862" title="Set representing the union of the set of current reserved ephemeral ports and the set of the last up-...">m_ephemeral_and_recent_ephemeral_ports</a> ports are available, pop front of queue (i.e., oldest recently used port) and use that. If emptied, there are simply no more ports left. </p>

<p class="definition">Definition at line <a class="el" href="port__space_8hpp_source.html#l00243">243</a> of file <a class="el" href="port__space_8hpp_source.html">port_space.hpp</a>.</p>

<p class="reference">Referenced by <a class="el" href="port__space_8cpp_source.html#l00112">reserve_ephemeral_port()</a>, and <a class="el" href="port__space_8cpp_source.html#l00175">return_port()</a>.</p>

</div>
</div>
<a id="ae4714945b23e588b1554240fa590560a" name="ae4714945b23e588b1554240fa590560a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae4714945b23e588b1554240fa590560a">&#9670;&nbsp;</a></span>m_rnd_generator</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#af4690f25a42ebb61561f91c9187bcc30">Random_generator</a> flow::net_flow::Port_space::m_rnd_generator</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Random number generator for picking ports. </p>

<p class="definition">Definition at line <a class="el" href="port__space_8hpp_source.html#l00246">246</a> of file <a class="el" href="port__space_8hpp_source.html">port_space.hpp</a>.</p>

<p class="reference">Referenced by <a class="el" href="port__space_8cpp_source.html#l00261">find_available_port_bit_idx()</a>.</p>

</div>
</div>
<a id="a1f8e8e52bf4ec90e0b13d9159c403eae" name="a1f8e8e52bf4ec90e0b13d9159c403eae"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1f8e8e52bf4ec90e0b13d9159c403eae">&#9670;&nbsp;</a></span>m_service_ports</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a729dc0add1c98ebde5b3549d3ec132e2">Bit_set</a> flow::net_flow::Port_space::m_service_ports</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Current service port set. </p>
<p >Bit 0 is port <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a6d07833521960b2f90806bfa7728cfd8" title="The port number of the lowest service port.">S_FIRST_SERVICE_PORT</a>, bit 1 is <code>S_FIRST_SERVICE_PORT + 1</code>, etc. In particular, this starts off as all 1s (all ports open). </p>

<p class="definition">Definition at line <a class="el" href="port__space_8hpp_source.html#l00213">213</a> of file <a class="el" href="port__space_8hpp_source.html">port_space.hpp</a>.</p>

<p class="reference">Referenced by <a class="el" href="port__space_8cpp_source.html#l00045">Port_space()</a>, <a class="el" href="port__space_8cpp_source.html#l00075">reserve_port()</a>, and <a class="el" href="port__space_8cpp_source.html#l00175">return_port()</a>.</p>

</div>
</div>
<a id="ab9a614b67638cbd9526eb82033a53352" name="ab9a614b67638cbd9526eb82033a53352"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab9a614b67638cbd9526eb82033a53352">&#9670;&nbsp;</a></span>S_FIRST_EPHEMERAL_PORT</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const <a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a> flow::net_flow::Port_space::S_FIRST_EPHEMERAL_PORT = <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a6d07833521960b2f90806bfa7728cfd8">S_FIRST_SERVICE_PORT</a> + <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ad93c0b6f23be37efe0f96ab066ff9bf8">S_NUM_SERVICE_PORTS</a></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>The port number of the lowest ephemeral port. </p>

<p class="definition">Definition at line <a class="el" href="port__space_8hpp_source.html#l00111">111</a> of file <a class="el" href="port__space_8hpp_source.html">port_space.hpp</a>.</p>

<p class="reference">Referenced by <a class="el" href="port__space_8cpp_source.html#l00045">Port_space()</a>, <a class="el" href="port__space_8cpp_source.html#l00112">reserve_ephemeral_port()</a>, and <a class="el" href="port__space_8cpp_source.html#l00175">return_port()</a>.</p>

</div>
</div>
<a id="a6d07833521960b2f90806bfa7728cfd8" name="a6d07833521960b2f90806bfa7728cfd8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6d07833521960b2f90806bfa7728cfd8">&#9670;&nbsp;</a></span>S_FIRST_SERVICE_PORT</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const <a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a> flow::net_flow::Port_space::S_FIRST_SERVICE_PORT = 1</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>The port number of the lowest service port. </p>

<p class="definition">Definition at line <a class="el" href="port__space_8hpp_source.html#l00108">108</a> of file <a class="el" href="port__space_8hpp_source.html">port_space.hpp</a>.</p>

<p class="reference">Referenced by <a class="el" href="port__space_8cpp_source.html#l00067">is_service_port()</a>, <a class="el" href="net__flow_2error_2error_8cpp_source.html#l00107">flow::net_flow::error::Category::message()</a>, <a class="el" href="port__space_8cpp_source.html#l00045">Port_space()</a>, <a class="el" href="port__space_8cpp_source.html#l00075">reserve_port()</a>, and <a class="el" href="port__space_8cpp_source.html#l00175">return_port()</a>.</p>

</div>
</div>
<a id="a0bdaf744b7089027c8d952b67d1f9cc0" name="a0bdaf744b7089027c8d952b67d1f9cc0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0bdaf744b7089027c8d952b67d1f9cc0">&#9670;&nbsp;</a></span>S_MAX_RECENT_EPHEMERAL_PORTS</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const size_t flow::net_flow::Port_space::S_MAX_RECENT_EPHEMERAL_PORTS = <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a06fb009aafc77f75241f721734fe3cc4">S_NUM_EPHEMERAL_PORTS</a> / 32</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>The maximum size of <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ae401e02d49ce557bbc5474e049eb5455" title="A FIFO of recently used but currently available ephemeral ports.">m_recent_ephemeral_ports</a>. </p>

<p class="definition">Definition at line <a class="el" href="port__space_8hpp_source.html#l00205">205</a> of file <a class="el" href="port__space_8hpp_source.html">port_space.hpp</a>.</p>

<p class="reference">Referenced by <a class="el" href="port__space_8cpp_source.html#l00175">return_port()</a>.</p>

</div>
</div>
<a id="a06fb009aafc77f75241f721734fe3cc4" name="a06fb009aafc77f75241f721734fe3cc4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a06fb009aafc77f75241f721734fe3cc4">&#9670;&nbsp;</a></span>S_NUM_EPHEMERAL_PORTS</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const size_t flow::net_flow::Port_space::S_NUM_EPHEMERAL_PORTS = <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#af0c60ec4732021d52a19e5d2f6dc8b35">S_NUM_PORTS</a> - <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#ad93c0b6f23be37efe0f96ab066ff9bf8">S_NUM_SERVICE_PORTS</a> - 1</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Total number of "ephemeral" ports (ones reserved at random with <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a65dbe99c7c4433e6c090f26c92ab3f78" title="Reserve a randomly chosen available ephemeral port.">reserve_ephemeral_port()</a>). </p>

<p class="definition">Definition at line <a class="el" href="port__space_8hpp_source.html#l00105">105</a> of file <a class="el" href="port__space_8hpp_source.html">port_space.hpp</a>.</p>

<p class="reference">Referenced by <a class="el" href="port__space_8cpp_source.html#l00045">Port_space()</a>, <a class="el" href="port__space_8cpp_source.html#l00112">reserve_ephemeral_port()</a>, and <a class="el" href="port__space_8cpp_source.html#l00175">return_port()</a>.</p>

</div>
</div>
<a id="af0c60ec4732021d52a19e5d2f6dc8b35" name="af0c60ec4732021d52a19e5d2f6dc8b35"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af0c60ec4732021d52a19e5d2f6dc8b35">&#9670;&nbsp;</a></span>S_NUM_PORTS</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const size_t flow::net_flow::Port_space::S_NUM_PORTS = size_t(std::numeric_limits&lt;<a class="el" href="namespaceflow_1_1net__flow.html#a079d8cd87a68d1c5f04c6bce71f0061d">flow_port_t</a>&gt;::max()) + 1</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Total number of ports in the port space, including <a class="el" href="namespaceflow_1_1net__flow.html#a9dd0c9d8de00fab78d8b0a3f50dad2a9" title="Special Flow port value used to indicate &quot;invalid port&quot; or &quot;please pick a random available ephemeral ...">S_PORT_ANY</a>. </p>

<p class="definition">Definition at line <a class="el" href="port__space_8hpp_source.html#l00099">99</a> of file <a class="el" href="port__space_8hpp_source.html">port_space.hpp</a>.</p>

</div>
</div>
<a id="ad93c0b6f23be37efe0f96ab066ff9bf8" name="ad93c0b6f23be37efe0f96ab066ff9bf8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad93c0b6f23be37efe0f96ab066ff9bf8">&#9670;&nbsp;</a></span>S_NUM_SERVICE_PORTS</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const size_t flow::net_flow::Port_space::S_NUM_SERVICE_PORTS = <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#af0c60ec4732021d52a19e5d2f6dc8b35">S_NUM_PORTS</a> / 2 - 1</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Total number of "service" ports (ones that can be reserved by number with <a class="el" href="classflow_1_1net__flow_1_1Port__space.html#a1168841ecd09d3187f9803eac2b8b703" title="Reserve the specified service port, or reserve_ephemeral_port() if the specified port is S_PORT_ANY.">reserve_port()</a>). </p>

<p class="definition">Definition at line <a class="el" href="port__space_8hpp_source.html#l00102">102</a> of file <a class="el" href="port__space_8hpp_source.html">port_space.hpp</a>.</p>

<p class="reference">Referenced by <a class="el" href="port__space_8cpp_source.html#l00067">is_service_port()</a>, <a class="el" href="net__flow_2error_2error_8cpp_source.html#l00107">flow::net_flow::error::Category::message()</a>, and <a class="el" href="port__space_8cpp_source.html#l00045">Port_space()</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>net_flow/detail/<a class="el" href="port__space_8hpp_source.html">port_space.hpp</a></li>
<li>net_flow/detail/<a class="el" href="port__space_8cpp_source.html">port_space.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Mar 28 2025 22:55:36 for Flow by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4
</small></address>
</body>
</html>
